import { reactive, onMounted } from 'vue'
import { getAppList } from '/@/api/app'

export default function useAppList() {
    const selectOpts = reactive({
        app: []
    });

    const getAppListReq = async () => {
        let p = { startIndex: 1, pageSize: 10000};
        let { data, respCode, respMsg } = await getAppList(p);
        if(respCode != 200) {
            console.error(respMsg);
            return;
        }
        selectOpts.app = data.list.map(e => ({label: e.clientName, value: e.id})) || [];
    }
    
    onMounted(getAppListReq)

    return  {
        selectOpts
    }
}

